#include "HiranipraShared.h"

#include "HCM/IComponent.h"

#ifndef _SHARED_PLATFORM_GRAPHICS_IGRAPHICSDEVICE_H_
#define _SHARED_PLATFORM_GRAPHICS_IGRAPHICSDEVICE_H_

namespace Hiranipra {
	namespace Platform {
		namespace Graphics {

			enum ClearFlags
			{
				ClearNone		= 0x01,
				ClearColor		= 0x02,
				ClearDepth		= 0x04,
				ClearStencil	= 0x08,
			};

			enum PrimitiveType
			{
				PrimitivePoints			= 0,
				PrimitiveLines			= 1,
				PrimitiveLineLoop		= 2,
				PrimitiveLineStrip		= 3,
				PrimitiveTriangles		= 4,
				PrimitiveTriangleStrip	= 5,
				PrimitiveTriangleFan	= 6,
				PrimitiveQuads			= 7
			};

			class IGraphicsDevice : implements RefInstance
			{
			public:
				virtual ~IGraphicsDevice(){}

				virtual ITextureLoader* GetTextureLoader() const = 0;
				virtual IProgramLoader* GetProgramLoader() const = 0;
				virtual IMeshLoader* GetMeshLoader() const = 0;

				virtual ITexture* CreateTexture( const BufferFlags flags, const uint32 width, const uint32 height, const PixelFormat format, const void* buffer = NULL ) const = 0;
				virtual IVertexBuffer* CreateVertexBuffer( const BufferFlags flags, VertexDeclaration* vertexDecl, const uint32 elementCount, const void* buffer = NULL ) const = 0;
				virtual IIndexBuffer* CreateIndexBuffer( const BufferFlags flags, const uint32 elementCount, const uint32 elementSize, const void* buffer = NULL ) const = 0;

				virtual int64 GetFrameCount() const = 0;
				virtual void BeginFrame( int clearFlags = ClearNone ) = 0;
				virtual void EndFrame() = 0;

				virtual void SetTexture( uint32 stage, ITexture* texture ) = 0;
				virtual void RenderBuffer( const PrimitiveType primitiveType, IVertexBuffer* vertexBuffer ) = 0;
				virtual void RenderIndexedBuffer( const PrimitiveType primitiveType, IVertexBuffer* vertexBuffer, IIndexBuffer* indexBuffer ) = 0;

				virtual void DrawDummy( float angle ) = 0;
			};

		}
	}
}

#endif // _SHARED_PLATFORM_GRAPHICS_IGRAPHICSDEVICE_H_
